﻿using MediatR;
using SheepStorage.API.Application.Command.SheepWeightCommand;
using SheepStorage.API.Baseclass;
using SheepStorage.Domain.Entity;
using SheepStorage.Service.Interface;

namespace SheepStorage.API.Application.CommandHandlers.SheepWeightHandler
{
    public class SheepWeightFtHandler : IRequestHandler<SheepWeightFtCommand, Results<SheepWeight>>
    {

        private readonly ISheepWeightService service;

        public SheepWeightFtHandler(ISheepWeightService service)
        {
            this.service = service;
        }

        /// <summary>
        /// 羊场称重反填
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public async Task<Results<SheepWeight>> Handle(SheepWeightFtCommand request, CancellationToken cancellationToken)
        {
            return Results<SheepWeight>.DataResult(service.GetFtSheepWeight(request.SheepWeightId));
        }
    }
}
